package com.pml.dao.proxy;

import com.pml.dao.IUserDAO;
import com.pml.dao.impl.UserDAOImpl;
import com.pml.dbc.DatabaseConnection;
import com.pml.vo.User;

public class UserDAOProxy implements IUserDAO{
    private DatabaseConnection dbc=null;
    private IUserDAO userDAO=null;

    public UserDAOProxy() {
        this.dbc = new DatabaseConnection();
        try {
            this.userDAO=new UserDAOImpl(dbc.getConnection());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public boolean findUser(User user) throws Exception {
        boolean flag=false;
        try {
            flag=userDAO.findUser(user);
        }catch (Exception e){
            throw e;
        }finally {
            dbc.close();
        }

        return flag;
    }
}
